//
// Created by enemy1205 on 2021/8/10.
//
#pragma once

#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include"../../Com_room/Include/com_room.h"
#include "../../Booking_order/Include/order.h"
using namespace std;
/*预申明使不报错*/
class Manager;

class Identity {
public:
    //信息初始化
    virtual void ID_init(string &name, string &passport, int &num) {};

    virtual void ID_init(string &name, string &passport) {};

    //菜单界面
    virtual void operMenu(const string& name) {};
    virtual void operMenu(const string& name,Manager *) {};

    inline string &get_name() { return m_Name; }

    inline string &get_passport() { return m_Passport; }

private:
    string m_Name;
    string m_Passport;
};

class student_re : public Identity {
public:
    void ID_init(string &name, string &passport, int &num) override ;

    void ID_init(string &name, string &passport) override {}

    void operMenu(const string& name) override{};
    void operMenu(const string& name,Manager *)override;

    //申请预约
    void applyOrder(Manager *manager);

    //查看我的预约
    bool showMyOrder();

    //查看所有预约
    void showAllOrder();

    //取消预约
    void cancelOrder();

    inline int &get_num() { return stu_num; }

private:
    int stu_num;
};

class teacher : public Identity {
public:
    void ID_init(string &name, string &passport, int &num) override;

    void ID_init(string &name, string &passport) override {};

    void operMenu(const string& name) override {};
    void operMenu(const string& name,Manager *)override;

    //查看所有预约
    void showAllOrder();

    //审核预约
    void validOrder();

    inline int &get_num() { return tea_num; }

private:
    int tea_num;
};

class Manager : public Identity {
public:
    void ID_init(string &name, string &passport, int &num) override {}

    void ID_init(string &name, string &passport) override {
        cout << "您现在以管理员的身份操作" << endl;
        get_name() = name;
        get_passport() = passport;
        this->count_num();
        cout << "当前学生数量为： " << vStu.size() << endl;
        cout << "当前教师数量为： " << vTea.size() << endl;
        cout << "当前机房数量为： " << vCom.size() << endl;
    }

    //添加账号
    void addAccount();

    //查看账号
    void showAccount();

    //查看机房信息
    void showComputer();

    //清空预约记录
    void cleanLog();

    void count_num();

    template<typename T>
    void check_repeated(vector<T> &);

    template<typename T>
    bool check_repeated(vector<T> &, int);

    void operMenu(const string& name) override;
    void operMenu(const string& name,Manager *) override{};
    inline vector<student_re> get_Stu(){return vStu;}
    inline vector<teacher> get_Tea(){return vTea;}
    inline vector<ComputerRoom> get_Com(){return vCom;}
private:
    //学生容器
    vector<student_re> vStu;
    //教师容器
    vector<teacher> vTea;
    //机房容器
    vector<ComputerRoom> vCom;
};